package summer_vacation.yangyiqing.m201508;
import java.util.Scanner;

/**
 * Created by Administrator on 2015/8/29 0029.
 */
public class Java_41 {
    public static void main(String[] args){
        System.out.println("请输入两个正整数：");
        Scanner s=new Scanner(System.in);
        int m=s.nextInt();
        int n=s.nextInt();
        int gongyueshu=GCD(m,n);
        int gongbeishu=m*n/gongyueshu;
        System.out.println("这两个数的最大公约数是："+gongyueshu+" 最小公倍数是："+gongbeishu);
    }
    public static int GCD(int m,int n){
        int s=0;
        int min=m;
        if(m>n)
            min=n;
        for(int i=min-1;i>0;i--){
            if(m%i==0&&n%i==0){
                s=i;
                break;
            }
        }
        return s;
    }
}
